//
//  ScoreViewController.m
//  ToucheTouche
//
//  Created by polytech polytech on 16/01/12.
//  Copyright (c) 2012 polytech. All rights reserved.
//

#import "ScoreViewController.h"
#import "SendScoreViewController.h"
#import "ScoresList.h"

@implementation ScoreViewController
@synthesize textViewScore;
@synthesize buttonWorld;
@synthesize buttonLocal;
@synthesize labelTitle;
@synthesize labelRank;
@synthesize buttonMenu;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    labelRank.text = @"-/-";
    [self pushLocal];
}

- (void)viewDidUnload
{
    [self setButtonMenu:nil];
    [self setButtonLocal:nil];
    [self setButtonWorld:nil];
    [self setTextViewScore:nil];
    [self setLabelTitle:nil];
    [self setLabelRank:nil];
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

- (void)dealloc {
    [buttonMenu release];
    [buttonLocal release];
    [buttonWorld release];
    [textViewScore release];
    [labelTitle release];
    [labelRank release];
    [super dealloc];
}

- (IBAction)pushMenu {
    [self setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
    [self dismissModalViewControllerAnimated:YES];
}
- (IBAction)pushLocal {
    textViewScore.text = [[ScoresList sharedScoresList] getStringScoresListLocal];
    labelTitle.text = @"Scores personnel";
}

- (IBAction)pushWorld {
    textViewScore.text = [[ScoresList sharedScoresList] getStringScoresListWorld];
    labelRank.text = [[ScoresList sharedScoresList] getRank];
    labelTitle.text = @"Scores mondiaux";
    
    SendScoreViewController *sendScoreViewController = [[SendScoreViewController alloc] initWithNibName:@"SendScoreViewController" bundle:nil];
    sendScoreViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentModalViewController:sendScoreViewController animated:YES];
    [sendScoreViewController release];
}

@end
